﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CommonFunc;

public partial class Manageweb_ManageBaseInfo : System.Web.UI.Page
{
    MODEL.BaseInfo MBI = new MODEL.BaseInfo();
    MODEL.BaseInfo _MBI = new MODEL.BaseInfo();

    BLL.BaseInfo BBI = new BLL.BaseInfo();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Cookies["MasterID"] == null)
        {
            Response.Redirect("Default.aspx");
        }

        if (!IsPostBack)
        {
            if (Request.QueryString["BaseInfoID"] != null)
            {
                LB_ID.Text = Request.QueryString["BaseInfoID"].ToString();

                PageDataInit();
            }
            else
            {
                Response.Redirect("Welcome.aspx");
            }
        }
    }


    #region 页面数据 [初始化]
    protected void PageDataInit()
    {
        try
        {
            MBI.BI_ID = Convert.ToInt32(LB_ID.Text);

            _MBI = BBI.GetDataByID(MBI);

            LB_Title.Text = _MBI.BI_Title;
            TB_Content.Text = CommonFunction.CharReConvert(_MBI.BI_Content);
        }
        catch (Exception ex)
        {
            LB_ManageBaseInfo.Text = ex.Message;
        }
    }
    #endregion


    #region 提交按钮 [Click]
    protected void Btn_Submit_Click(object sender, EventArgs e)
    {
        try
        {
            MBI.BI_Content = CommonFunction.CharConvert(TB_Content.Text);
            MBI.BI_ID = Convert.ToInt32(LB_ID.Text);

            BBI.Mod(MBI);

            LB_ManageBaseInfo.Text = "修改成功";
        }
        catch (Exception ex)
        {
            LB_ManageBaseInfo.Text = ex.Message;
        }
    }
    #endregion
}
